Skip to content

API File Cleanup#3798

Merged
bgavrilMS merged 6 commits intomasterfrom
PublicApiCleanup
Apr 29, 2026
Merged

API File Cleanup#3798
bgavrilMS merged 6 commits intomasterfrom
PublicApiCleanup

Conversation

@tlupes
Copy link
Copy Markdown
Collaborator

@tlupes tlupes commented Apr 29, 2026

API File Cleanup

Reduce developer toil by removing internal API files, documenting methods which are used cross-project, and reduce API file duplication.

Description

This removes the InternalAPI tracking files from nearly all projects and consolidates per-target-framework PublicAPI folder layouts into a smaller, shared structure. There is no functional change to any code files, this is purely to the tracking files (and a few comments).

Motivation

The Microsoft.CodeAnalysis.PublicApiAnalyzers "internal API" tracking (RS0051–RS0058) was producing significant
maintenance overhead:

  • Every internal member required updates to InternalAPI.Unshipped.txt per target framework.
  • Tracking churn was disproportionate to the value, since the vast majority of Internal APIs are not used between projects.

In addition, the Per-TFM folders for Public API duplicated nearly identical content and required careful editing of each with each new member.

Changes

.editorconfig

  • Disabled the internal-API analyzer rules (RS0051, RS0052, RS0053, RS0054, RS0055, RS0057, RS0058).
  • Kept public-API analyzer rules.

Internal API Files

Removed all Internal API files with the sole exception of Microsoft.Identity.Web.Diagnostics, as that project is entirely internal and intended to be used by other Microsoft.Identity.Web.* projects.

Public API Files

  • Moved all public API files into PublicAPI folder for consistency.
  • Audited all Public API files to find duplication and move them into folders that relate to what they support, not their TFM. This consolidated (nearly) all projects into two buckets: ones that share all members with all TFM, and ones that have different members for NetCore and NetFramework. A single special case, Web, had to have special handling.

Projects that can use a single set of Public API files:

  • AgentIdentifies
  • Azure
  • Certificate
  • Certificateless
  • Diagnostics (this also applies to the Internal API files)
  • GraphServiceClientBeta
  • Owin
  • OidcFIC
  • TokenCache

Projects that need different files for NetCore and NetFramework:

  • DownstreamApi
  • GraphServiceClient
  • MicrosoftGraph
  • MicrosoftGraphBeta
  • TokenAcquisition

The only special case is Microsoft.Identity.Web, which has some members which are only available for .net8 and .net9. That is handled with a special "NetCore_Pre10" folder. This assembly does not support NetFramework, so it still only has two folders (NetCore and NetCore_Pre10).

Internal API Usage Comments

Added comments to each internal member which has legitimate usage in other Microsoft.Identity.Web Non-Test assemblies, with a listing of which assemblies use them and a warning to not modify the members.

The majority of these comments are on Microsoft.Identity.Web.TokenAcquisition.

Impact

  • No public API changes. Public API tracking files (PublicAPI.Shipped.txt / PublicAPI.Unshipped.txt) remain in
    place, and the RS0016/RS0017 analyzers continue to enforce them.
  • No runtime/behavioral changes. Source edits are comments only.

@tlupes tlupes requested a review from a team as a code owner April 29, 2026 15:34
@bgavrilMS bgavrilMS merged commit ce9f7c4 into master Apr 29, 2026
4 checks passed
@bgavrilMS bgavrilMS deleted the PublicApiCleanup branch April 29, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants